/-api
/-api/docs
/-api/storage
DocumentState.ts
LineAccess.ts
PropertyAccess.ts
Storage.ts
/-app ...
/-app/storage ...
/-app/storage/pluggable ...
/-app/storage/pluggable/localStorage ...
LocalStorage.ts
LocalStorageDocumentState.ts
LocalStorageImplementation.ts
LocalStoragePreloaded.ts
LocalStoragePropertyAccess.ts
GlobalStorage.ts
PluggableStorage.ts
PreloadedStorage.ts
PropertyKeyCache.ts
Application.ts
utils.ts
/-imports
/-typings
ko.ts
mark
sample-js.js
sample.html
sample.ts
schedule.ts
1
module teapo.app.storage.pluggable {
2
 
3
  export class LocalStorageImplementation implements Storage {
4
 
5
    private _editedKey: string;
6
    private _documentNamesKey: string;
7
    private _documentNames: string[] = null;
8
 
9
    globalProperties: PropertyAccess;
10
 
11
    constructor(
12
      private _localStorage,
13
      private _uniqueKey: string,
14
      populate: { edited: Date }) {
15
 
16
      this._editedKey = this._uniqueKey + '*edited';
17
      this._documentNamesKey = this._uniqueKey + '*documentNames';
18
 
19
      try {
20
        var edited = this._localStorage[this._editedKey];
21
        populate.edited = edited ? new Date(parseInt(edited)) : null;
22
      }
23
      catch (parseError) {
24
        populate.edited = null;
25
      }
26
    }
27
 
28
    documentNames(callback: (error: Error, names: string[]) => void) {
29
 
30
      if (!this._documentNames) {
31
        var documentNamesStr = this._localStorage[this._documentNamesKey];
32
 
33
        if (typeof documentNamesStr !== 'string')
34
          this._documentNames = [];
35
        else
36
          this._documentNames = documentNamesStr.split('\n');
37
      }
38
 
39
      callback(null, this._documentNames);
40
    }
41
 
42
    getDocument(fullPath: string, callback: (error: Error, docState: DocumentState) => void) {
43
      throw null;
44
    }
45
 
46
    removeDocument(fullPath: string, callback: (error: Error) => void) {
47
      throw null;
48
    }
49
 
50
    createDocument(fullPath: string, callback: (error: Error, docState: DocumentState) => void) {
51
      throw null;
52
    }
53
 
54
 
55
    loadMaster() {
56
 
57
    }
58
 
59
    loadSecondary(storage: Storage) {
60
 
61
      //
62
 
63
    }
64
  }
65